package com.example.tioWsServer.handler;

import org.tio.core.ChannelContext;
import org.tio.http.common.HttpRequest;
import org.tio.http.common.HttpResponse;
import org.tio.websocket.common.WsRequest;
import org.tio.websocket.server.handler.IWsMsgHandler;

public class TioWsServerAioHandler implements IWsMsgHandler {


    private WsServerHandlerBase  wsServerHandlerBase;

    public TioWsServerAioHandler(WsServerHandlerBase  wsServerHandlerBase){

        this.wsServerHandlerBase=wsServerHandlerBase;
    }

    @Override
    public HttpResponse handshake(HttpRequest httpRequest, HttpResponse httpResponse, ChannelContext channelContext) throws Exception {
        return this.wsServerHandlerBase.handshake(httpRequest, httpResponse, channelContext);
    }

    @Override
    public void onAfterHandshaked(HttpRequest httpRequest, HttpResponse httpResponse, ChannelContext channelContext) throws Exception {
        this.wsServerHandlerBase.onAfterHandshaked(httpRequest, httpResponse, channelContext);
    }

    @Override
    public Object onBytes(WsRequest wsRequest, byte[] bytes, ChannelContext channelContext) throws Exception {
        return this.wsServerHandlerBase.onBytes(wsRequest, bytes, channelContext);
    }

    @Override
    public Object onClose(WsRequest wsRequest, byte[] bytes, ChannelContext channelContext) throws Exception {
        return this.wsServerHandlerBase.onClose(wsRequest, bytes, channelContext);
    }

    @Override
    public Object onText(WsRequest wsRequest, String text, ChannelContext channelContext) throws Exception {
        return this.wsServerHandlerBase.onText(wsRequest, text, channelContext);
    }
}
